<template>
  <div class="navHeader">
    <div class="top">
		<div class="inside">
			<a href="javascript:;" class="logo"></a>
      <!-- <router-link :to="{path:'/'}" class="logo"></router-link> -->
			<ul class="topnav clearfix">
				<li><router-link :to="{path:'/',query:{type:1}}" :class="{current:type==1}">首页</router-link></li>
				<li @click="advantage"><router-link :to="{path:'/',query:{type:2}}" :class="{current:type==2}">合作优势</router-link></li>
				<li><router-link :to="{path:'/about',query:{type:3}}" :class="{current:type==3}">关于我们</router-link></li>
			</ul>
			<div class="log" id="dd">
        <router-link :to="{path:'/login',query:{type:1}}">登录</router-link>
				<span>丨</span>
				<router-link :to="{path:'/Register',query:{type:1}}">注册</router-link>
			</div>
		</div>
	</div>
  </div>
</template>
<script>
export default {
  name: "navHeader",
  data() {
    return {
      type: 1,
      winScroll: 0
    };
  },
  mounted() {},
  methods: {
    advantage() {
      window.scrollTo(0, 750);
    }
  },
  watch: {
    $route(to, from) {
      this.type = this.$route.query.type;
      if (
        (from.name == "register" &&
          to.name == "index" &&
          to.query.type == "2") ||
        (from.name == "login" && to.name == "index" && to.query.type == "2") ||
        (from.name == "resetpsw" && to.name == "index" && to.query.type == "2")
      ) {
        window.scrollTo(0, 750);
      }
    }
  }
};
</script>
<style>

</style>
